//
//  SetLocationResponse.m
//  NetMobileLocation
//
//  Created by Mehmet Sinan Şahin on 1/29/12.
//  Copyright (c) 2012 netgis. All rights reserved.
//

#import "SetLocationResponse.h"
#import "NSString+Extensions.h"

@implementation SetLocationResponse

- (void) parse {

    /*
    //response xml standartlaştırılıyor
    //response xml in başına ve sonuna DataRetrievingServiceResults tag'i eklenmiyor
    if (![NSString isEmpty:responseXml]) {
        responseXml = [NSString stringWithFormat:@"%@%@%@",
                       @"<DataRetrievingServiceResults>", 
                       responseXml, 
                       @"</DataRetrievingServiceResults>"];
    }
    */
    
    NSString *testMessage = @"<Messages>" 
    "<Message>"
    "<Sender>netadmin1</Sender>"
    "<Time>13.01.2012 16:57:43</Time>"
    "<Command>0</Command>" 
    "<CommandParameter>message_header|test mesaj body--> adkla asdasda lasdka dasd alskdaldas ce  slsakdka alsdklasş as. Nadadl sad al. asdkşla.</CommandParameter>" 
    "</Message>"
    "<Message>"
    "<Sender>netadmin2</Sender>"
    "<Time>13.01.2012 16:59:06</Time>"
    "<Command>1</Command>" //send frequency
    "<CommandParameter>2</CommandParameter>"
    "</Message>"
    "</Messages>";
    
    
    if ([self test] && ![NSString isEmpty:responseXml]) {
        responseXml = [responseXml stringByReplacingOccurrencesOfString:@"<Messages />" withString:testMessage];
    }
    
    
    [super parse];
}

+ (SetLocationResponse *) test {
    return [[[SetLocationResponse alloc] initWithResponseXml:TEST_XML_SUCCESS_SETLOCATION] autorelease];
}


@end
